package drds.server.sqlparser.sqlobject.expression.data_type.number;

import drds.server.sqlparser.visitor.Visitor;

/**
 * 
 * @author 曹正辉<330937205@qq.com>
 * 
 */
public class Decimal extends Numeric {

	private Number number;

	public Decimal() {

	}

	public Decimal(Number number) {

		this.number = number;
	}

	public void setNumber(Number number) {
		this.number = number;
	}

	public Number getNumber() {
		return this.number;
	}

	public void output(StringBuffer sb) {
		sb.append(this.number.toString());
	}

	protected void accept0(Visitor visitor) {
		visitor.visit(this);
		visitor.endVisit(this);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((number == null) ? 0 : number.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null) {
			return false;
		}
		if (getClass() != o.getClass()) {
			return false;
		}
		Decimal other = (Decimal) o;
		if (number == null) {
			if (other.number != null) {
				return false;
			}
		} else if (!number.equals(other.number)) {
			return false;
		}
		return true;
	}
}
